<script>
function olvideContrasena() {
var form = document.getElementById('formlogin');
                form.action = 'login/olvidoContrasena';
                form.submit();

}
</script>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title><?php echo $title ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Sistema de gestión hospitalaria">
    <meta name="author" content="DP2">
    <link href="<?php echo base_url(); ?>media/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>media/chosen/chosen.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>media/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>media/bootstrap/css/docs.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>media/latisoft/css/switch.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>media/bootstrap/css/cambiosLatisoft.css" rel="stylesheet">
    <script src="<?php echo base_url(); ?>media/jquery/jquery.min.js" type="text/javascript"></script>
</head>

<body>

<div class="container-fluid">

    <div class="row-fluid">
        <div class="span3"></div>
        <div class="span6 well btn-primary" align="center"><img src="<?php echo base_url(); ?>media/img/latisoft-header.png"/></div>
        <div class="span3"></div>
    </div>

    <?php
    if ($errorMsg != ''){
        echo "
                    <div class='row-fluid'>
                    <div class='span3'></div>
                    <div class='span6 alert alert-error'>$errorMsg</div>
                    <div class='span3'></div>   
                    </div>";
    }
    ?>

    <div class="row-fluid">
        <div class="span3"></div>

        <div class="span6">
            <p><?php echo validation_errors(); ?></p>
            <form name="formlogin" id="formlogin" class="form-horizontal well" method="post" action="<?php echo base_url(); ?>login/validaLogin" accept-charset="utf-8">
                <fieldset>
                    <legend>Inicio de Sesión
                    </legend>

                    <input class="checkbox" type="checkbox" id="bool_movil" name="bool_movil" checked="false">
                    
                    <div class="control-group">
                        <?php if ($this->session->flashdata('error')){ ?>
                        <div class='message' style="text-align:center; margin-bottom:10px; color:red">
                            <?php echo $this->session->flashdata('error'); ?>
                        </div>
                        <?php } ?>
                        <label class="control-label" for="user">Usuario</label>
                        <div class="controls"><input type="text" class="input-xlarge" name="user" id="user"></div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="pass">Contraseña</label>
                        <div class="controls"><input type="password" class="input-xlarge" name="pass" id="pass"></div>
                    </div>

                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary">Ingresar</button>
                        <button type="button" class="btn btn-primary" onclick="olvideContrasena();">Olvidé mi contraseña</button>
                    </div>

                </fieldset>
            </form>
        </div>

        <div class="span3"></div>

    </div>

    <div class="row-fluid">
        <div class="span3"></div>
        <div class="span6" align="center">Usuario para personal | usuario: personal, contraseña: cualquiera</div>
        <div class="span3"></div>
    </div>


</div>
<hr>

<footer>
    <p>&copy; LatiSoft 2012</p>
</footer>

  <script>
  $(document).ready(function() {
    
    $('body').attr("class","js");
    
     $('.checkbox').after(function(){
       if ($(this).is(":checked")) {
         return "<div class='control-group'>\n\
                    <label class='control-label'>Móvil</label>\n\
                    <div class='controls'><a href='#' class='toggle' ref='"+$(this).attr("id")+"'></a><div>\n\
                </div>";
         
       }else{
         return "<div class='control-group'>\n\
                    <label class='control-label'>Móvil</label>\n\
                    <div class='controls'><a href='#' class='toggle checked' ref='"+$(this).attr("id")+"'></a><div>\n\
                </div>";
       }
     });
     
    $('.toggle').click(function(e) {
       var checkboxID = $(this).attr("ref");
       var checkbox = $('#'+checkboxID);

       if (checkbox.is(":checked")) {
         checkbox.removeAttr("checked");

       }else{
         checkbox.attr("checked","true");
       }
       $(this).toggleClass("checked");

       e.preventDefault();

    });  
    
  });

  </script>

</body>
</html>
